package cn.mily.basics.config;

import cn.mily.user.interceptor.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorMvcConfig implements WebMvcConfigurer {

    @Autowired
    private Interceptor interceptor;

    /*添加拦截器*/
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /*拦截全部路劲*/
        /*放行登录 注册 用户相关 上传图片服务器*/
        registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns("/login/**")
                .excludePathPatterns("/user/**").excludePathPatterns("/fastdfs/**").excludePathPatterns("/register.html")
                .excludePathPatterns("/index.html").excludePathPatterns("/wechat/*");
    }
}
